home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Sources / FWFctInf.cpp < prev    next >
Encoding:
Text File  |  1995-11-08  |  3.1 KB  |  100 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWFctInf.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWOS.hpp"
  11.  
  12. #ifndef FWFCTINF_H
  13. #include "FWFctInf.h"
  14. #endif
  15.  
  16. #ifndef FWREFCNT_H
  17. #include "FWRefCnt.h"
  18. #endif
  19.  
  20. // ----- OpenDoc Includes -----
  21.  
  22. #ifndef SOM_ODFacet_xh
  23. #include <Facet.xh>
  24. #endif
  25.  
  26. //========================================================================================
  27. //    Runtime Informations
  28. //========================================================================================
  29.  
  30. #if FW_LIB_EXPORT_PRAGMAS
  31. #pragma lib_export on
  32. #endif
  33.  
  34. #ifdef FW_BUILD_MAC    
  35. #pragma segment fwgraphx
  36. #endif
  37.  
  38. //========================================================================================
  39. //    class FW_CFacetPartInfo
  40. //========================================================================================
  41.  
  42. //----------------------------------------------------------------------------------------
  43. //    FW_CFacetPartInfo::FW_CFacetPartInfo
  44. //----------------------------------------------------------------------------------------
  45.  
  46. FW_CFacetPartInfo::FW_CFacetPartInfo():
  47.     fMagicNumber(FW_kMagicNumber),
  48.     fDevice(NULL)
  49. {
  50. }
  51.  
  52. //----------------------------------------------------------------------------------------
  53. //    FW_CFacetPartInfo::InitFacetPartInfo
  54. //----------------------------------------------------------------------------------------
  55.  
  56. void FW_CFacetPartInfo::InitFacetPartInfo(Environment* ev, ODFacet* facet)
  57. {
  58.     fDevice = GraphicDeviceFactory(ev, facet);
  59. }
  60.  
  61. //----------------------------------------------------------------------------------------
  62. //    FW_CFacetPartInfo::~FW_CFacetPartInfo
  63. //----------------------------------------------------------------------------------------
  64.  
  65. FW_CFacetPartInfo::~FW_CFacetPartInfo()
  66. {
  67.     // ----- Note: We don't delete the window because we don't own it -----
  68.     
  69.     // ----- Release the device -----
  70.     fDevice->Release();
  71.     fDevice = NULL;
  72. }
  73.  
  74. //----------------------------------------------------------------------------------------
  75. //    FW_CFacetPartInfo::GetFacetPartInfo
  76. //----------------------------------------------------------------------------------------
  77.  
  78. FW_CFacetPartInfo* FW_CFacetPartInfo::GetFacetPartInfo(Environment* ev, ODFacet* facet)
  79. {
  80.     FW_CFacetPartInfo* partInfo = (FW_CFacetPartInfo*)facet->GetPartInfo(ev);
  81.     
  82.     // ----- If partInfo is NULL or doesn't have the right magic number, facet ------
  83.     // ----- was not one of our facet (This can appended in FW_CWindowContext) -----
  84.     if (partInfo == NULL || partInfo->fMagicNumber != FW_kMagicNumber)
  85.         return NULL;
  86.     
  87.     return partInfo;
  88. }
  89.  
  90. //----------------------------------------------------------------------------------------
  91. //    FW_CFacetPartInfo::GraphicDeviceFactory
  92. //----------------------------------------------------------------------------------------
  93.  
  94. FW_CGraphicDevice* FW_CFacetPartInfo::GraphicDeviceFactory(Environment* ev, ODFacet* facet)
  95. {
  96.     return new FW_CGraphicDevice(ev, facet->GetCanvas(ev));    // refcount of returned device is one
  97. }
  98.  
  99.  
  100.